<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>${message("admin.product.list")} - 766 SMART HOME</title>
<meta name="author" content="BIZ Team" />
<meta name="copyright" content="BIZ" />
<link href="${base}/resources/admin/css/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${base}/resources/admin/js/jquery.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/common.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/list.js"></script>
<style type="text/css">
.moreTable th {
	width: 80px;
	line-height: 25px;
	padding: 5px 10px 5px 0px;
	text-align: right;
	font-weight: normal;
	color: #333333;
	background-color: #f8fbff;
}

.moreTable td {
	line-height: 25px;
	padding: 5px;
	color: #666666;
}

.promotion {
	color: #cccccc;
}
</style>
<script type="text/javascript">
$().ready(function() {
	$("[name=isRelease] option[value=${cases.isRelease}]").attr("selected", "selected");
	$("[name=isCompleted] option[value=${cases.isCompleted}]").attr("selected", "selected");
	$("[name=productCategory] option[value=${cases.productCategory}]").attr("selected", "selected");
	$("[name=houseType] option[value=${cases.houseType}]").attr("selected", "selected");
	var $listForm = $("#listForm");
	var $moreButton = $("#moreButton");
	var $filterOption = $("#filterOption a");
	
	[@flash_message /]
	
	// 筛选选项
	$filterOption.click(function() {
		var $this = $(this);
		var $dest = $("#" + $this.attr("name"));
		if ($this.hasClass("checked")) {
			$dest.val("");
		} else {
			$dest.val($this.attr("val"));
		}
		$listForm.submit();
		return false;
	});
	$("#deleteButton").click( function() {
		var ids=getIds();
		if(!ids){
			$.message("error","请选择一条数据！");
			return false;
		}
		$.dialog({
			type: "warn",
			content: message("admin.dialog.deleteConfirm"),
			ok: message("admin.dialog.ok"),
			cancel: message("admin.dialog.cancel"),
			onOk: function() {
				window.location.href="delete.jhtml?id="+ids;
			}
		});
	});
	//排序
	$(".sort").click(function(){
		var properties = $(this).attr("info")+" "+$(this).attr("sort");
		var sorts = $(this).attr("sort");
		if(sorts =='' || sorts=='asc' ){
			if(sorts==''){
				properties=properties+" asc";
			}
			sorts = "desc";
			$(this).attr("sort"," desc");
		}else{
			sorts = "asc";
			$(this).attr("sort"," asc");
		}
		sort(properties,sorts);
	});
});
function  getIds (){
	var arrChk=$("input[name='ids']:checked");
	if(arrChk.length>0){
		var str="";
		for(var i=0;i<arrChk.length;i++){
			var id=arrChk[i].value;
			if(i<arrChk.length-1){
				str+=id+",";
			}else{
				str+=id;
			}
		}
		return str.split(",");
	}
	return null;
}
function sort(properties,sorts){
		window.location.href="list.jhtml?properties="+properties+"&sort="+sorts;
}
</script>
</head>
<body>
	<div class="path">
		<a href="${base}/admin/common/index.jhtml">${message("admin.path.index")}</a> &raquo;案例列表<span>(${message("admin.page.total", page.total)})</span>
	</div>
	<form id="listForm" action="list.jhtml" method="get">
		<input type="hidden" id="productCategoryId" name="productCategoryId" value="${productCategoryId}" />
		<input type="hidden" id="brandId" name="brandId" value="${brandId}" />
		<input type="hidden" id="promotionId" name="promotionId" value="${promotionId}" />
		<input type="hidden" id="tagId" name="tagId" value="${tagId}" />
		<input type="hidden" id="isMarketable" name="isMarketable" value="[#if isMarketable??]${isMarketable?string("true", "false")}[/#if]" />
		<input type="hidden" id="isList" name="isList" value="[#if isList??]${isList?string("true", "false")}[/#if]" />
		<input type="hidden" id="isTop" name="isTop" value="[#if isTop??]${isTop?string("true", "false")}[/#if]" />
		<input type="hidden" id="isGift" name="isGift" value="[#if isGift??]${isGift?string("true", "false")}[/#if]" />
		<input type="hidden" id="isOutOfStock" name="isOutOfStock" value="[#if isOutOfStock??]${isOutOfStock?string("true", "false")}[/#if]" />
		<input type="hidden" id="isStockAlert" name="isStockAlert" value="[#if isStockAlert??]${isStockAlert?string("true", "false")}[/#if]" />
		<div class="bar">
		<span id="searchPropertySelect">&nbsp;是否发布:</span>
		 <select class="option" name="isRelease">
			<option value="">请选择</option>
			<option value="true">是</option>
			<option value="false">否</option>
		</select>
		<span id="searchPropertySelect">&nbsp;是否竣工:</span>
		 <select class="option" name="isCompleted">
			<option value="">请选择</option>
			<option value="true">是</option>
			<option value="false">否</option>
		</select>
		<span id="searchPropertySelect">&nbsp;系统:</span>
		 <select class="option" name="productCategory">
		 	<option value="">请选择</option>
		 	[#list listPc as lipc]
			<option value="${lipc.id}">${lipc.name}</option>
			[/#list]
		 </select>
		<span id="searchPropertySelect">&nbsp;户型分类:</span>
		 <select class="option" name="houseType">
			<option value="">请选择</option>
		 	[#list dictionaryList as dic]
		 		<option value="${dic.id}">${dic.title}</option>
			[/#list]
		</select>
		<input type="submit" class="button" id="bt" value="查询" />
		</div>
		<div class="bar">
			<div class="buttonWrap">
				<a href="addPage.jhtml" class="iconButton">
					<span class="addIcon">&nbsp;</span>${message("admin.common.add")}
				</a>
				<a href="javascript:;" id="deleteButton" class="iconButton disabled">
					<span class="deleteIcon">&nbsp;</span>${message("admin.common.delete")}
				</a>
				<a href="javascript:;" id="refreshButton" class="iconButton">
					<span class="refreshIcon">&nbsp;</span>${message("admin.common.refresh")}
				</a>
				<div class="menuWrap">
					<div class="popupMenu">
						<ul id="filterOption" class="check">
							<li>
								<a href="javascript:;" name="isMarketable" val="true"[#if isMarketable?? && isMarketable] class="checked"[/#if]>${message("admin.product.isMarketable")}</a>
							</li>
							<li>
								<a href="javascript:;" name="isMarketable" val="false"[#if isMarketable?? && !isMarketable] class="checked"[/#if]>${message("admin.product.notMarketable")}</a>
							</li>
							<li class="separator">
								<a href="javascript:;" name="isList" val="true"[#if isList?? && isList] class="checked"[/#if]>${message("admin.product.isList")}</a>
							</li>
							<li>
								<a href="javascript:;" name="isList" val="false"[#if isList?? && !isList] class="checked"[/#if]>${message("admin.product.notList")}</a>
							</li>
							<li class="separator">
								<a href="javascript:;" name="isTop" val="true"[#if isTop?? && isTop] class="checked"[/#if]>${message("admin.product.isTop")}</a>
							</li>
							<li>
								<a href="javascript:;" name="isTop" val="false"[#if isTop?? && !isTop] class="checked"[/#if]>${message("admin.product.notTop")}</a>
							</li>
							<li class="separator">
								<a href="javascript:;" name="isGift" val="true"[#if isGift?? && isGift] class="checked"[/#if]>${message("admin.product.isGift")}</a>
							</li>
							<li>
								<a href="javascript:;" name="isGift" val="false"[#if isGift?? && !isGift] class="checked"[/#if]>${message("admin.product.nonGift")}</a>
							</li>
							<li class="separator">
								<a href="javascript:;" name="isOutOfStock" val="false"[#if isOutOfStock?? && !isOutOfStock] class="checked"[/#if]>${message("admin.product.isStack")}</a>
							</li>
							<li>
								<a href="javascript:;" name="isOutOfStock" val="true"[#if isOutOfStock?? && isOutOfStock] class="checked"[/#if]>${message("admin.product.isOutOfStack")}</a>
							</li>
							<li class="separator">
								<a href="javascript:;" name="isStockAlert" val="false"[#if isStockAlert?? && !isStockAlert] class="checked"[/#if]>${message("admin.product.normalStore")}</a>
							</li>
							<li>
								<a href="javascript:;" name="isStockAlert" val="true"[#if isStockAlert?? && isStockAlert] class="checked"[/#if]>${message("admin.product.isStockAlert")}</a>
							</li>
						</ul>
					</div>
				</div>
				<div class="menuWrap">
					<a href="javascript:;" id="pageSizeSelect" class="button">
						${message("admin.page.pageSize")}<span class="arrow">&nbsp;</span>
					</a>
					<div class="popupMenu">
						<ul id="pageSizeOption">
							<li>
								<a href="javascript:;"[#if page.pageSize == 10] class="current"[/#if] val="10">10</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageSize == 20] class="current"[/#if] val="20">20</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageSize == 50] class="current"[/#if] val="50">50</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageSize == 100] class="current"[/#if] val="100">100</a>
							</li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		<table id="listTable" class="list">
			<tr>
				<th class="check">
					<input type="checkbox" id="selectAll" />
				</th>
				<th>
					<a href="javascript:;" class="sort" info="sn" sort="${sort}" name="sn">编号</a>
				</th>
				<th>
					<a href="javascript:;" class="sort" info="theme" sort="${sort}" name="theme">主题</a>
				</th>
				<th>
					<a href="javascript:;" class="sort" info="product_category_came" sort="${sort}" name="productCategoryName">商品分类</a>
				</th>
				<th>
					<a href="javascript:;" class="sort" info="is_completed" sort="${sort}" name="isCompleted">是否竣工</a>
				</th>
				<th>
					<a href="javascript:;" class="sort" info="is_release" sort="${sort}" name="isRelease">是否发布</a>
				</th>
				<th>
					<a href="javascript:;" class="sort" info="create_date" sort="${sort}" name="createDate">创建日期</a>
				</th>
				<th>
					<a href="javascript:;" class="sort" name="">操作</a>
				</th>
			</tr>
			[#list page.content as li]
				<tr>
					<td>
						<input type="checkbox" name="ids" value="${li.id}" />
					</td>
					<td>
						${li.sn}
					</td>
					<td>
						${li.theme}
					</td>
					<td>
						${li.productCategoryName}
					</td>
					[#if li.isCompleted==true]
					<td>
						已竣工
					</td>
					[/#if]
					[#if li.isCompleted==false]
					<td>
						未竣工
					</td>
					[/#if]
					[#if li.isRelease==true]
					<td>
						已发布
					</td>
					[/#if]
					[#if li.isRelease==false]
					<td>
						未发布
					</td>
					[/#if]
					<td>
						${li.createDate}
					</td>
					<td>
						<a href="${base}/admin/cases/edit.jhtml?id=${li.id}">[编辑]</a><a href="${base}/admin/cases/view.jhtml?id=${li.id}">[查看]</a>
					</td>
				</tr>
			[/#list]
		</table>
		[@pagination pageNumber = page.pageNumber totalPages = page.totalPages]
			[#include "/admin/include/pagination.ftl"]
		[/@pagination]
	</form>
</body>
</html>